package thread;

public class Demo5 {
    public static void main(String[] args) {
        //比较推荐的写法，匿名内部类的平替
        Thread t = new Thread( () -> {
            while (true){
                System.out.println("Thread - 0");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        },"我的线程");

        t.start();
        while (true){
            System.out.println("hello main");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
